PROP_0,
PROP_GICON,
+ PROP_FALLBACK_GICON,
+
PROP_ICON_NAME,
PROP_ICON_SIZE,
PROP_FALLBACK_ICON_NAME,
st_icon_set_gicon (icon, g_value_get_object (value));
break;
+ case PROP_FALLBACK_GICON:
+ st_icon_set_fallback_gicon (icon, g_value_get_object (value));
+ break;
+
case PROP_ICON_NAME:
st_icon_set_icon_name (icon, g_value_get_string (value));
break;
g_value_set_object (value, st_icon_get_gicon (icon));
break;
+ case PROP_FALLBACK_GICON:
+ g_value_set_object (value, st_icon_get_fallback_gicon (icon));
+ break;
+
case PROP_ICON_NAME:
g_value_set_string (value, st_icon_get_icon_name (icon));
break;
G_TYPE_ICON,
ST_PARAM_READWRITE);
+ props[PROP_FALLBACK_GICON] =
+ g_param_spec_object ("fallback-gicon",
+ "Fallback GIcon",
+ "The fallback GIcon shown if the normal icon fails to load",
+ G_TYPE_ICON,
+ ST_PARAM_READWRITE);
+
props[PROP_ICON_NAME] =
g_param_spec_string ("icon-name",
"Icon name",
st_icon_update (icon);
}
+/**
+ * st_icon_get_fallback_gicon:
+ * @icon: a #StIcon
+ *
+ * Gets the currently set fallback #GIcon.
+ *
+ * Returns: (transfer none): The fallback #GIcon, if set, otherwise %NULL
+ */
+GIcon *
+st_icon_get_fallback_gicon (StIcon *icon)
+{
+ g_return_val_if_fail (ST_IS_ICON (icon), NULL);
+
+ return icon->priv->fallback_gicon;
+}
+
+/**
+ * st_icon_set_fallback_gicon:
+ * @icon: a #StIcon
+ * @fallback_gicon: (nullable): the fallback #GIcon
+ *
+ * Sets a fallback #GIcon to show if the normal icon fails to load.
+ * If @fallback_gicon is %NULL or fails to load, the icon is unset and no
+ * texture will be visible for the fallback icon.
+ */
+void
+st_icon_set_fallback_gicon (StIcon *icon,
+ GIcon *fallback_gicon)
+{
+ g_return_if_fail (ST_IS_ICON (icon));
+ g_return_if_fail (fallback_gicon == NULL || G_IS_ICON (fallback_gicon));
+
+ if (g_icon_equal (icon->priv->fallback_gicon, fallback_gicon))
+ return;
+
+ g_set_object (&icon->priv->fallback_gicon, fallback_gicon);
+ g_object_notify_by_pspec (G_OBJECT (icon), props[PROP_FALLBACK_GICON]);
+
+ st_icon_update (icon);
+}
+
/**
* st_icon_get_icon_size:
* @icon: an #StIcon
void st_icon_set_gicon (StIcon *icon,
GIcon *gicon);
+GIcon *st_icon_get_fallback_gicon (StIcon *icon);
+void st_icon_set_fallback_gicon (StIcon *icon,
+ GIcon *fallback_gicon);
+
const gchar *st_icon_get_icon_name (StIcon *icon);
void st_icon_set_icon_name (StIcon *icon,
const gchar *icon_name);